package structures;

import java.util.LinkedList;

public class ADsList {
	private LinkedList<AD> adsList;
	private boolean hasPredecessors;
	private boolean hasSuccessors;

	public ADsList() {
		adsList = new LinkedList<AD>();
	}
	
	public LinkedList<AD> getAdsList() {
		return adsList;
	}
	
	public void setAdsList(LinkedList<AD> adsList) {
		this.adsList = adsList;
	}

	public void addAD(AD advertisement) {
		this.adsList.add(advertisement);
	}
	
	public void setHasPredecessors(boolean hasPredecessors) {
		this.hasPredecessors = hasPredecessors;
	}

	public void setHasSuccessors(boolean hasSuccessors) {
		this.hasSuccessors = hasSuccessors;
	}
	
	public long getMaxId() {
		long max=0;
		for(AD ad: adsList){
			if(ad.getId()>max)
				max = ad.getId();
		}
		return max;
	}
	
	public long getMinId() {
		long min=adsList.get(0).getId();
		for(AD ad: adsList){
			if(ad.getId()<min)
				min = ad.getId();
		}
		return min;
	}
}
